from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client


server_params = StdioServerParameters(command="uv",
                      args=[
                          "run",
                           "--with",
                           "mcp[cli]",
                           "--with-editable",
                           "/Users/zhangwenwen/PycharmProjects/ai_2025/achievement",
                           "mcp",
                           "run",
                           "/Users/zhangwenwen/PycharmProjects/ai_2025/achievement/server.py"
                      ],
                      env=None
                      )

async def run():
    async with stdio_client(server_params) as (read, write):
        async with ClientSession(read, write) as session:
            # Initialize the connection
            await session.initialize()

            tools = await session.list_tools()

            print("工具列表：", tools)

            score = await session.call_tool(name="get_score_by_name", arguments={"name": "张三"})

            print("score: ", score)


if __name__ == "__main__":
    import asyncio
    asyncio.run(run())

